﻿using Lmondeil.Crm.EF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace Atlanchim.Crm.Mui.Pages.Alertes
{
    public class AssignContactToAlertCommand : ICommand, IDisposable
    {
        public Alerte Alerte { get; set; }

        public AssignContactToAlertCommand()
        {
        }

        public AssignContactToAlertCommand(Alerte alerte)
        {
            this.Alerte = alerte;
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            if (parameter is Contact)
            {
                this.Alerte.Contact = (Contact)parameter;
            }
        }

        public void Dispose()
        {
            this.Alerte = null;
        }
    }
}
